<div class="editcate_top">
    <h2>Thêm mới sản phẩm</h2>
    <a href="javascript:void(0)" onclick ="$('#light_adct').hide();$('#fade_adct').hide()"><img src="<?php echo img_link('close.png', 'admin'); ?>" class="png" /></a>
</div>

<div id="div_message"></div>

<form enctype="multipart/form-data" method="post" action="<?php echo action_link('add'); ?>" id="product_form">
<div class="editcate_ct">
	<div class="btarticle">
    	<input type="button" value="Cancel" class="btn" onclick="$('#light_adct').hide();$('#fade_adct').hide();" />
        <input type="submit" value="Save & Continute" class="btn" />
    </div>
	<div class="boxadd">
    	<ul class="linect">     	   	
            <li>
                <span class="left"><b>Tên sản phẩm<font color="red">(*)</font> :</b></span>
                <span class="right"><input type="text" name="name" value="" style="width:100%; margin:0;" /></span>
            </li>
            <li>
                <span class="left"><b>Mã sản phẩm<font color="red">(*)</font> :</b></span>
                <span class="right"><input type="text" name="code" value="" style="width:60%; margin:0;" /></span>
            </li>
            <li>
                <span class="left"><b>Loại sản phẩm<font color="red">(*)</font> :</b></span>
                <span class="right">                
                	<select id="cmb_product_type" name="cmb_product_type" style="width:60%; height:30px; overflow:auto; line-height:22px;">
		        		<?php foreach($product_type as $pro_type):?>
		        			<option value="<?php echo $pro_type->id;?>"><?php echo $pro_type->name;?></option>
		        		<?php endforeach;?>
	            	</select>
                </span>
            </li>
            <li>
                <span class="left">Hãng sản xuất<font color="red">(*)</font> :</span>
                <span class="right">                	
	            	<select id="cmb_company" name="cmb_company" style="width:60%; height:30px; overflow:auto; line-height:22px;">
		        		<?php foreach($company as $com):?>
		        			<option value="<?php echo $com->id;?>"><?php echo $com->name;?></option>
		        		<?php endforeach;?>
	            	</select>
                </span>
            </li>
            <li>
                <span class="left">Công năng sử dụng<font color="red">(*)</font> :</span>
                <span class="right">                	
	            	<select id="cmb_utilities" name="cmb_utilities" style="width:60%; height:30px; overflow:auto; line-height:22px;">
		        		<?php foreach($utilities as $uti):?>
		        			<option value="<?php echo $uti->id;?>"><?php echo $uti->name;?></option>
		        		<?php endforeach;?>
	            	</select>
                </span>
            </li>
            <li>
                <span class="left">Số chiều<font color="red">(*)</font> :</span>
                <span class="right">                	
	            	<select id="cmb_dimension" name="cmb_dimension" style="width:60%; height:30px; overflow:auto; line-height:22px;">		        		
		        			<option value="1">1 chiều</option>
		        			<option value="2">2 chiều</option>		        		
	            	</select>
                </span>
            </li>
            <li>
                <span class="left">Nước sản xuất:</span>
                <span class="right"><input type="text" name="txt_country" value="" style="width:60%; margin:0;" /></span>
            </li>
            <li>
                <span class="left">Mô tả sản phẩm: </span>
                <span class="right"><textarea cols="50" rows="5" style="width:100%;" name="txt_description"></textarea></span>
            </li>
            <li>
                <span class="left">Hạn bảo hành:</span>
                <span class="right"><input type="text" name="txt_warranty" value="" style="width:60%; margin:0;" />(Năm)</span>
            </li>
            <li>
                <span class="left">Công suất điện</span>
                <span class="right"><input type="text" name="txt_electric_power" value="" style="width:60%; margin:0;" /> (BTU)</span>
            </li>
            <li>
                <span class="left">Công suất lạnh</span>
                <span class="right"><input type="text" name="txt_cool_power" value="" style="width:60%; margin:0;" /> (BTU)</span>
            </li>
            <li>
                <span class="left">Kích thước:</span>
                <span class="right"><input type="text" name="txt_size" value="" style="width:60%; margin:0;" /></span>
            </li>
            <li>
                <span class="left">Kích thước cục nóng:</span>
                <span class="right"><input type="text" name="txt_hot_size" value="" style="width:60%; margin:0;" /> (VD: 510 x 650 x 230 mm)</span>
            </li>
            <li>
                <span class="left">Kích thước cục lạnh:</span>
                <span class="right"><input type="text" name="txt_cool_size" value="" style="width:60%; margin:0;" /> (VD: 510 x 650 x 230 mm)</span>
            </li>   
            <li>
                <span class="left">Trọng lượng cục nóng:</span>
                <span class="right"><input type="text" name="txt_hot_weight" value="" style="width:60%; margin:0;" /> (Kg)</span>
            </li>         
            <li>
                <span class="left">Trọng lượng cục lạnh:</span>
                <span class="right"><input type="text" name="txt_cool_weight" value="" style="width:60%; margin:0;" /> (Kg)</span>
            </li>
            <li>
                <span class="left">Điện năng tiêu thụ:</span>
                <span class="right"><input type="text" name="txt_power_consumption" value="" style="width:60%; margin:0;" /> (VD: 1.150W - 1.110W)</span>
            </li>
            <li>
                <span class="left">Khả năng hút ẩm:</span>
                <span class="right"><input type="text" name="txt_absorb_moisture" value="" style="width:60%; margin:0;" /> (VD: 2.1L/h - 4.4 Pt/h)</span>
            </li>            
            <li>
                <b>Tính năng:<font color="red">(*)</font></b>
            </li>
            <li>
                <span class="right"><textarea id="txt_features" name="txt_features"  style="width:100%; height:200px;"></textarea></span>
                <script type="text/javascript">
				$(function() {				    				    
				    $('#news_form').iframer({
				        onComplete: function(msg){
				        	if(msg == 'yes') {
				        		$('#light_adct').hide();$('#fade_adct').hide();
				        		var reload_link = '<?php echo action_link('index?cat_id='); ?>'+$('[name=cat_id]').val();
				        		if(window.location.href == reload_link) {
				        			load_content('list', window.location.href, true);
				        		}
				        		else {
				        			window.location.href = reload_link;	
				        		}
				        	}
				        	else show_error('div_message', msg)
				        }
				    });
				    
					if(CKEDITOR.instances['txt_features']) {						
						CKEDITOR.remove(CKEDITOR.instances['txt_features']);
					}
					CKEDITOR.config.width = 504;
				    CKEDITOR.config.height = 400;
					CKEDITOR.replace('txt_features',{
				    	toolbar :
				    		[['Source','Maximize','-','Format','Font','FontSize'],'/',
					    	 ['PasteText','PasteFromWord'],
					         ['TextColor','BGColor','-','Bold','Italic','Underline'],
					         ['NumberedList','BulletedList'],'/',
					         ['Outdent','Indent','Blockquote'],
					         ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
					         ['Image','Table','-', 'Link', 'Unlink' ]]
					});
				})
				</script>                
            </li>
            <li>
                <span class="left"><b>Giá bán:</b></span>
                <span class="right">
                	<input type="text" name="txt_price" id="txt_price" value="" style="width:60%; margin:0;color: red;font-weight: bold;" /> (VNĐ)
                </span>
            </li>
            <?php for($i = 1; $i < 5; $i++): ?>
            <li>
                <span class="left">Ảnh sản phẩm</span>
                <span class="right">                	                	
                	<input type="file" name="images[]" value="" /><br />                	
                </span>
            </li>
            <?php endfor; ?>

            <li id="add_more">
                <span class="left"><b>&nbsp;</b></span>
                <span class="right">
                	<a href="javascript:void(0)" onclick="add_more_image();"><img alt="" title="" src="<?php echo img_link('add.gif', 'admin'); ?>"></a>
                </span>
            </li>
            <li>
       			<span class="left"><b>Sản phẩm nổi bật:</b></span>
       			 <span class="right">
                    <select style="width:130px;" name="hot" id="hot">
                      <option value="yes" style="color: red;">Yes</option>
                      <option value="no" style="color: blue;">No</option>
                    </select>
                </span>
       		</li>
       		<li>
       			<span class="left"><b>Sản phẩm bán chạy:</b></span>
       			 <span class="right">
                    <select style="width:130px;" name="best_sales" id="best_sales">
                      <option value="yes" style="color: red;">Yes</option>
                      <option value="no" style="color: blue;">No</option>
                    </select>
                </span>
       		</li>
       		<li>
       			<span class="left"><b>Trạng thái:</b></span>
       			 <span class="right">
                    <select style="width:130px;" name="status" id="status">
                      <option value="yes" style="color: red;">Kích hoạt</option>
                      <option value="no" style="color: blue;">Chưa kích hoạt</option>
                    </select>
                </span>
       		</li>
       		
        </ul>
    </div>
    <div class="btarticle">
    	<input type="button" value="Cancel" class="btn" onclick="$('#light_adct').hide();$('#fade_adct').hide();" />
        <input type="submit" value="Save & Continute" class="btn" />

    </div>
</div>
</form>
<script>
$('#product_form').iframer({
    onComplete: function(msg){
    	if(msg == 'yes') {
    		$('#light_adct').hide();$('#fade_adct').hide();
            load_content('product_list', window.location.href, true);
    	}
    	else show_error('div_message', msg)
    }
});
</script>